package com.jorado.redis.extend;

public class JoradoRedisNodeInfo {
    //
    private String host;
    //
    private int port = 6379;
    //
    private int startSlot;
    //
    private int endSlot;
    //
    private JoradoNodeState nodeState;

    JoradoRedisNodeInfo() {

    }

    JoradoRedisNodeInfo(String host, int port, int startSlot, int endSlot, JoradoNodeState nodeState) {
        this.host = host;
        this.port = port;
        this.startSlot = startSlot;
        this.endSlot = endSlot;
        this.nodeState = nodeState;
    }

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public int getStartSlot() {
        return startSlot;
    }

    public void setStartSlot(int startSlot) {
        this.startSlot = startSlot;
    }

    public int getEndSlot() {
        return endSlot;
    }

    public void setEndSlot(int endSlot) {
        this.endSlot = endSlot;
    }

    public JoradoNodeState getNodeState() {
        return nodeState;
    }

    public void setNodeState(JoradoNodeState nodeState) {
        this.nodeState = nodeState;
    }

    public boolean isNodeFail() {
        return this.nodeState == JoradoNodeState.FAIL || this.nodeState == JoradoNodeState.PFAIL;
    }
}
